package health.lm.com.order.presenter;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;
import health.lm.com.order.activity.OrderListActivity;
import health.lm.com.order.entity.OrderListEntity;
import health.lm.com.order.entity.RecordListEntity;
import health.lm.com.order.model.OrderModel;

/**
 * @author GQI
 * @description: 订单列表
 * @date :2019-08-10 14:59
 */
public class OrderListPresent extends XPresent<OrderListActivity> {
    public void getListMore(boolean isRefresh, Object layout,int page, int pageSize) {
        OrderModel.getInstance().orderList( page, pageSize, new SimpleCallBack<OrderListEntity>() {
            @Override
            public void onSuccess(OrderListEntity entities) {

                if (hasV()) {
                    getV().getListSuccess(entities.getList());
                }
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }

            @Override
            public void onError(ApiException e) {
                super.onError(e);
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }
        });
    }
}
